package com.muatocroi.tornado;

import java.net.InetAddress;

public class CommandSendFile extends CommandSignal {

	public CommandSendFile() {
		cmdCode = 102;
	}

	public static CommandSendFile Address(InetAddress addr) {
		CommandSendFile c = new CommandSendFile();
		c.exCode = 0;

		byte[] b = addr.getAddress();
		c.arg = ((b[3] & 0xFF) << (3 * 8)) + ((b[2] & 0xFF) << (2 * 8)) + ((b[1] & 0xFF) << (1 * 8)) + (b[0] & 0xFF);
		return c;
	}

	public static CommandSendFile Port(int port) {
		CommandSendFile c = new CommandSendFile();
		c.exCode = 1;
		c.arg = port;
		return c;
	}

	public static CommandSendFile Open(boolean b) {
		CommandSendFile c = new CommandSendFile();
		c.exCode = 2;
		c.arg = b ? 1 : 0;
		return c;
	}
}
